﻿using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Albatross.SharePoint.Explorer.ViewModels {
	public class ListTemplateViewModel : ClientObjectViewModel {
		public ListTemplateViewModel(ClientContext context, string name, ListTemplate clientObject)
			: base(context, name, clientObject) {
		}
		public ListTemplate ListTemplate { get { return (ListTemplate)ClientObject; } }
		public override string GetTreeItemTitle() {
			if (Name == string.Empty) {
				if (string.IsNullOrEmpty(ListTemplate.Name)) {
					return string.Format("({0})", ListTemplate.InternalName);
				} else {
					return string.Format("{0} ({1})", ListTemplate.Name, ListTemplate.InternalName);
				}
			} else {
				return Name;
			}
		}
		public override string GetContentTitle() {
			return ListTemplate.Name;
		}
	}
}
